package com.mall.controller;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.mall.bean.Goods;
import com.mall.service.IGoodsService;
import com.mall.service.IIdleService;

@Controller
public class IdleController {

	@Resource
	private IIdleService idleService;

	@Resource
	private IGoodsService goodsService;


	//跳转闲置1
	@RequestMapping("idle-goods-1")
	public String idle_goods_1(Model model, Goods goods) {

		List<Goods> goodsAll = goodsService.findGoods(goods);

		model.addAttribute("goodsAll", goodsAll);
		return "idle-goods-1";

	}

	//跳转闲置2
	@RequestMapping("idle-goods-2")
	public String idle_goods2(Model model, Goods goods) {
		List<Goods> goodsAll = goodsService.findGoods(goods);

		model.addAttribute("goodsAll", goodsAll);
		return "idle-goods-2";
	}

	@RequestMapping("showClassify-idle")
	public String idle(@Param("requestName") String requestName, @Param("classify") String classify, Model model, Goods goods) {

		goods.setBelong("闲置");
		goods.setGoods(requestName);
		goods.setGoods_classify(classify);
		List<Goods> goodsAll = idleService.findClassify(goods);

		model.addAttribute("goodsAll", goodsAll);
		return "idle-goods-1";


	}


}
